<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>

</body>
<script type="text/javascript">
    // 打印出1000-2000年中所有的闰年，并以每行四个数的形式输出
    // 2000 2004 2008 2012
    // 2016 2020 2024 2028
    var i = 0;
    for (var year = 1000; year <= 2000; year++) {
        if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) {
            if(i % 4 == 0){
                document.write("<br>")
            }
            i ++
            document.write(year+"  ")
        }
    }
</script>

</html>